1. Field of the Invention
The present invention relates to an electronic device for executing programs stored in a main storage unit.
2. Description of the Related Art
For example, an electronic device, which executes a program by reading the program upon activation of a system into which the device is incorporated, loads all program codes to a main storage unit from a program storing secondary storage unit such as a flash ROM and thereafter starts a process upon activation of the system.
FIG. 10 is a diagram showing the construction of the main portion of such an electronic device disclosed in, e.g., Japanese Patent Application Laid Open No. Hei 9-146774 and the like, and FIG. 11 is a flowchart showing the operation at the time of its setup.
As shown in FIG. 10, this conventional example includes a central processing unit (CPU) 1 for reading and executing a program, an activation ROM 2, such as a flash memory, for storing an activation program, a program storing ROM 3 for storing programs such as controlling programs, and a main storage unit 4 such as a DRAM.
Next, the operation of the conventional example will be described with reference to the flow chart shown in FIG. 11. First, when power is turned on (step S1), the CPU 1 executes the activation program stored in the activation ROM 2 (step S2), initializes hardware (H/W) (step S3), loads program codes to the main storage unit 4 from the program storing ROM 3 (step S4), and executes programs (step S5) to thereby activate the system.
However, such a conventional example has addressed the following problems.
(1) Since the programs are executed by loading all the program codes from the program storing ROM to the main storage unit for activating the system, the system activation time is restricted by the program size and the memory access time.
(2) Since it takes time to activate the system, a process requiring programs to be executed immediately after power has been turned on (i.e., a process requiring quick response) cannot be performed as required.
(3) Since all the program codes are loaded to the main storage unit 4 at once, the capacity of the main storage unit 4 depends on the size of the program codes.
(4) Since each type of vehicle on which the electronic device is mounted requires a dedicated program storing ROM of its own, if an erasable and rewritable flash memory or the like is used as the program storing ROM and if the size of the program codes is large, an expensive component such as a flash memory or the like is required, and thus the cost is increased.
Accordingly, the present invention has been made to overcome these problems inherent in the conventional examples, and therefore has an object of the invention to provide an electronic device for executing program codes stored in a main storage unit, which allows system activation time to be reduced by loading only such program codes as requiring quick response to the main storage unit without loading all the program codes, and by executing only such program codes immediately thereafter.
According to the present invention, there is provided an electronic device comprising: an operation processing unit for executing programs; a main storage unit having virtual addresses; a program storage element for storing a plurality of divided program codes and for storing loading program codes for loading the program codes to the main storage unit; an information table storing element for storing an information table having a description of information about the program codes to be loaded from the program storage element to the main storage unit; a map management element having a description of virtual addresses in the main storage unit at which the program codes stored in the program storage element are mapped; and a virtual address decode element for checking a correspondence between a virtual address referenced at the time of the execution of a program and where in the main storage unit the program code corresponding to the program is actually mapped.
In a preferred form of the present invention, the electronic device further comprises an abnormality determiner for detecting the occurrence of an abnormality, and that the program storage element stores an abnormality processing program and the operation processing unit load the abnormality processing program to the main storage unit from the program storage element when the abnormality determiner has detected an occurrence of the abnormality.
In another preferred form of the present invention, the information table includes information about an order in which the program codes are loaded to the main storage unit.
In a further preferred form of the present invention, one of the program codes stored in the program storage element is a real time OS, and the other program codes are divided in terms of each task to be executed.
In a still further preferred form of the present invention, the information table has a description of program codes required to be loaded for each type of vehicle on which the electronic device is to be mounted.
In a yet further preferred form of the present invention, each of the program codes is generated by compiling a source program, and divided in terms of each function.
In a further preferred form of the present invention, each of the program codes has a trigger for loading a next program code.